/*  ConwayGo: also called philosophers' football, a game on a go board
    Copyright (C) 2004  Michael Keuchen
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
package de.tabacha.cgo.gui;

import java.text.MessageFormat;
import java.util.ResourceBundle;


/** Helper class to retrieve localized information for GUI.
   <br />$Id: I18n.java,v 1.5 2004/12/23 21:42:44 mk Exp $
   @author michael@tabacha.de
   @author $Author: mk $
   @version $Revision: 1.5 $
   @threadsafe false
*/
public class I18n
{

    // ------------------------ constants ------------------------------------

    private static final String basename = "de.tabacha.cgo.gui.I18n";

    // ------------------------ static attributes ----------------------------

    private static final ResourceBundle messages = ResourceBundle.getBundle(basename);


    // ------------------------ static methods -------------------------------

    /** Returns the translated message. */
    public static String get(String key)
    { return messages.getString(key); }

    /** Returns the translated message with applied parameters.
	@see java.text.MessageFormat
    */
    public static String get(String key, Object[] arguments)
    { return MessageFormat.format(messages.getString(key), arguments); }

    /** Returns the translated message with the parameter applied.
	@see java.text.MessageFormat
    */
    public static String get(String key, String argument)
    { return MessageFormat.format(messages.getString(key), new String[]{argument}); }

}
